package com.yourwork.dao.imp;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.yourwork.common.jpa.ConsumptionRepositoey;
import com.yourwork.dao.ConsumptionDao;
import com.yourwork.model.Consumption;
@Repository(value="recordDao")
public class ConsumptionDaoImp implements ConsumptionDao {
	@Autowired
	private ConsumptionRepositoey recordRepositoey;

	public Page<Consumption> queryRecord(Pageable pageable) {
		// TODO Auto-generated method stub
		return recordRepositoey.findAll(pageable);
	}
	
	public void insertRecord(Consumption record) {
		// TODO Auto-generated method stub
		recordRepositoey.save(record);
	}

	public int countRecord() {
		// TODO Auto-generated method stub
		return (int)recordRepositoey.count();
	}

	public List<String> queryNumber(Pageable pageable) {
		// TODO Auto-generated method stub
		return recordRepositoey.queryNumber(pageable);
	}

	public List<Consumption> querySalaryDetails(String number) {
		// TODO Auto-generated method stub
		return recordRepositoey.findByNumber(number);
	}

	public int countNumber() {
		// TODO Auto-generated method stub
		return recordRepositoey.queryNumber().size();
	}

	public List<String> queryNumber() {
		// TODO Auto-generated method stub
		return recordRepositoey.queryNumber();
	}

	public int countSalaryDetails(String number) {
		// TODO Auto-generated method stub
		return recordRepositoey.findByNumber(number).size();
	}

	public List<Consumption> querySalaryDetails(String number, Pageable pageable) {
		// TODO Auto-generated method stub
		return recordRepositoey.findByNumber(number,pageable);
	}

}
